﻿'use strict';
(function () {
    //注意JS的绑定顺序，第一组绑定的文件可以用angular.module('MyControllers', []);，后续的文件只能用angular.module('MyControllers')
    var service = angular.module('MyServices');

    service.factory('unExpectedService', ['$http', function (http) {
        var methods = {
            // 考试计划
            examPlanSrv: {
                getList: function (type) {
                    return http.post('/ExamPlan/GetList/', { planType: type });
                }
            },

            // 选择场次
            chooseScene: {
                getSceneList: function (planId) {
                    return http.post('/ExamPlan/GetSceneList/', { planId: planId });
                },
                generateCode: function (planId, sceneId) {
                    return http.post('/UnExpected/GenerateCode/', { planId: planId, sceneId: sceneId });
                }
            },

            // 验证码
            validateCode: {
                validCode: function (code) {
                    return http.post('/UnExpected/ValidCode/', { authorizationCode: code });
                }
            },

            // 意外处理
            controlSrv: {
                getRoomList: function (planId, sceneId, subjectId) {
                    return http.post('/ExamPlan/GetRoomList/', { planId: planId, sceneId: sceneId, subjectId: subjectId });
                },
                getSubjectList: function (planId, sceneId, roomId) {
                    return http.post('/ExamPlan/GetSubjectList/', { planId: planId, sceneId: sceneId, roomId: roomId });
                },
                getDetailList: function (planId, sceneId, roomId, subjectId, statusId, parameter) {
                    return http.post('/UnExpected/LoadDetail/', { planId: planId, sceneId: sceneId, roomId: roomId, subjectId: subjectId, statusId: statusId, parameter: parameter });
                },
                saveTime: function (planId, sceneId, examineeIds, adjustTime, comments) {
                    return http.post('/UnExpected/SaveTime/', { planId: planId, sceneId: sceneId, examineeIds: examineeIds, adjustTime: adjustTime, comments: comments });
                }
            },

            // 申请重考
            retakeSrv: {
                applyRetake: function (planId, sceneId, examineeId, adjustTime, comments) {
                    return http.post('/UnExpected/ApplyRetake/', { planId: planId, sceneId: sceneId, examineeId: examineeId, adjustTime: adjustTime, comments: comments });
                }
            }
        };
        return methods;
    }]);
})();